using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;

namespace ElevatorSIM
{
    public partial class SystemSetting : KryptonForm
    {
        private MainForm mainform = null;
        private Language language = null;
        private IniFile ini = new IniFile("Sys.ini");
        public SystemSetting(MainForm form)
        {
            InitializeComponent();
            mainform = form;
            language = new Language(ini.GetString("Language", "Type", "English"));
            ChangLanguage(ini.GetString("Language", "Type", "English"));
        }

        private void ChangLanguage(string lan)
        {
            language.ChangeLanguage(lan);
            this.Text = language.System_Settings;
            LanguageText.Text = language.Language_Type;
            this.CertainButton.Text=language.Certain_Button_Text;
            this.ApplyButton.Text= language.Apply_Button_Text;
            this.Language_Type.SelectedIndex = Language_Type.Items.IndexOf(lan);
            
        }

        private void ApplyButton_Click(object sender, EventArgs e)
        {
            mainform.ChangeLanguage(Language_Type.Text, mainform);
            this.ChangLanguage(Language_Type.Text);
            ini.WriteValue("Language", "Type", Language_Type.Text);
        }

        
    }
}